home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / utils / terminal / qterm-6.0 / qterm-6 / options.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-19  |  1.9 KB  |  76 lines

  1. /*
  2.  * Copyright (c) 1990 Michael A. Cooper.
  3.  * This software may be freely distributed provided it is not sold for 
  4.  * profit and the author is credited appropriately.
  5.  */
  6.  
  7. /*
  8.  * $Header: /src/common/usc/lib/libuscgen/RCS/options.h,v 1.8 1993/03/19 01:54:29 mcooper Exp $
  9.  */
  10.  
  11.  
  12. #include <stdio.h>
  13. #include <sys/types.h>
  14. #include <sys/errno.h>
  15.  
  16. #define Num_Opts(o)    (sizeof(o)/sizeof(OptionDescRec))
  17. #define HELPSTR        "-help"
  18. #define __        (caddr_t)
  19.  
  20. #ifndef SYSERR
  21. #define SYSERR        sys_errlist[errno]
  22. #endif
  23. #ifndef TRUE
  24. #define TRUE    1
  25. #endif
  26. #ifndef FALSE
  27. #define FALSE    0
  28. #endif
  29.  
  30. /*
  31.  * Values for OptionDescRec.flags.
  32.  */
  33. #define NoArg        0x001    /* No argument for this option.  Use
  34.                    OptionDescRec.value. */
  35. #define IsArg        0x002    /* Value is the option string itself */
  36. #define SepArg        0x004    /* Value is in next argument in argv */
  37. #define StickyArg    0x008    /* Value is characters immediately following 
  38.                    option */
  39. #define SkipArg        0x010    /* Ignore this option and the next argument in 
  40.                    argv */
  41. #define SkipLine    0x020    /* Ignore this option and the rest of argv */
  42. #define SkipNArgs    0x040    /* Ignore this option and the next 
  43.                    OptionDescRes.value arguments in argv */
  44. #define ArgHidden    0x080    /* Don't show in usage or help messages */
  45.  
  46. /*
  47.  * Option description record.
  48.  */
  49. typedef struct {
  50.     char    *option;        /* Option string in argv        */
  51.     int         flags;            /* Flag bits                */
  52.     int        (*cvtarg)();        /* Function to convert argument     */
  53.     caddr_t     valp;            /* Variable to set            */
  54.     caddr_t     value;            /* Default value to provide        */
  55.     char    *usage;            /* Usage message            */
  56.     char    *desc;            /* Description message            */
  57. } OptionDescRec, *OptionDescList;
  58.  
  59. void UsageOptions();
  60. void HelpOptions();
  61. void UserError();
  62. int ParseOptions();
  63. OptionDescRec *FindOption();
  64.  
  65. int OptBool();
  66. int OptInt();
  67. int OptLong();
  68. int OptShort();
  69. int OptStr();
  70.  
  71. extern char *OptionChars;
  72. extern int errno;
  73. extern char *sys_errlist[];
  74. extern long strtol();
  75. extern char *strcpy();
  76.